var cpDatas = [
	{"pid":"1177898","title":"G17巴斯夫汽油添加剂","spec":"60ml/瓶","number":"10瓶装","price":"350","img_src":"images/1.jpg"},
	{"pid":"1177899","title":"3M汽油添加剂20019","spec":"100ml/瓶","number":"12瓶装","price":"299","img_src":"images/2.jpg"},
	{"pid":"1177900","title":"车仆玻璃防雾剂","spec":"218ml","number":"1瓶装","price":"19.9","img_src":"images/3.jpg"},
	{"pid":"1177901","title":"车仆雨刷精","spec":"60ml/瓶","number":"12瓶装","price":"26.9","img_src":"images/4.jpg"},
	{"pid":"1177902","title":"车仆多功能泡沫清洗剂","spec":"550ml","number":"1瓶装","price":"8","img_src":"images/5.jpg"},
	{"pid":"1177903","title":"车仆表板蜡","spec":"450ml","number":"1瓶装","price":"18.9","img_src":"images/6.jpg"},
	{"pid":"1177904","title":"车仆柏油清洗剂","spec":"450ml","number":"1瓶装","price":"16.9","img_src":"images/7.jpg"},
	{"pid":"1177905","title":"车仆制冷套装","spec":"环保雪种(250g*3罐)+ 雪种油(70ml*1罐)","number":"1套","price":"70","img_src":"images/8.jpg"},
	{"pid":"1174430","title":"小叶紫檀挂件-年年有余","number":"1只装","price":"110","img_src":"images/9.jpg"},
	{"pid":"1174429","title":"小叶紫檀挂件-马到成功","number":"1只装","price":"110","img_src":"images/10.jpg"}
	
	]

// 2.实例Vue对象
	new Vue({
	    el: '.g-box',
	    data: {
				cpData: cpDatas
	    },
	    methods: {
	    	// APP端接口
	    	getApp:function(key,value){
	    		var appData = {"key":key,"value":value};
	    		// alert("key值是:"+key+",vlaue值是:"+value);
	    		//判断访问终端
					var browser={
					    versions:function(){
					        var u = navigator.userAgent, app = navigator.appVersion;
					        return {
					            trident: u.indexOf('Trident') > -1, //IE内核
					            presto: u.indexOf('Presto') > -1, //opera内核
					            webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
					            gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
					            mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
					            ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
					            android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端
					            iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
					            iPad: u.indexOf('iPad') > -1, //是否iPad
					            webApp: u.indexOf('Safari') == -1, //是否web应该程序，没有头部与底部
					            weixin: u.indexOf('MicroMessenger') > -1, //是否微信 （2015-01-22新增）
					            qq: u.match(/\sQQ/i) == " qq" //是否QQ
					        };
					    }(),
					    language:(navigator.browserLanguage || navigator.language).toLowerCase()
					}

				// 判断是安卓还是苹果
				if(browser.versions.android){
					getAppData(JSON.stringify(appData));
				}else{
					var iver = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
					iver = parseInt(iver[1],10);
					// IOS 8以上用webkit方法,IOS 8以下用UIWebview方法
			        if(iver >= 8){
			            // AppModel是OC所注入的对象
    					window.webkit.messageHandlers.AppModel.postMessage({body:appData});
			        }else{
    					getAppData(appData);
			        }
				}
	    	}
	    }
	})